import {Component} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
import {Occasion} from "../../models/occasion.model";
import {LostOrFindService} from "../../services";

@Component({
  selector: 'app-detail',
  templateUrl: './detail.component.html',
  styleUrl: './detail.component.css'
})
export class DetailComponent {
  occasion: Occasion | undefined;
  returnUrl: string | undefined;
  constructor(private activateRoute: ActivatedRoute,private lostOrFindService: LostOrFindService) {
    let id = activateRoute.snapshot.params["id"];
    this.activateRoute.queryParams.
    subscribe(params => {
      this.returnUrl = decodeURIComponent(params['returnUrl']);
    });
    this.lostOrFindService.getDirect(id).subscribe((ocassion)=>
      this.occasion = ocassion
    );

  }
}
